package com.ruoyi.LXHComplaint.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.LXHComplaint.domain.DocComplaintLXH;
import com.ruoyi.LXHComplaint.service.IDocComplaintLXHService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 个人投诉Controller
 * 
 * @author ruoyi
 * @date 2025-08-16
 */
@RestController
@RequestMapping("/LXHComplaint/LXHDocComplaint")
public class DocComplaintLXHController extends BaseController
{
    @Autowired
    private IDocComplaintLXHService docComplaintLXHService;

    /**
     * 查询个人投诉列表
     */
    @PreAuthorize("@ss.hasPermi('LXHComplaint:LXHDocComplaint:list')")
    @GetMapping("/list")
    public TableDataInfo list(DocComplaintLXH docComplaintLXH)
    {
        startPage();
        List<DocComplaintLXH> list = docComplaintLXHService.selectDocComplaintLXHList(docComplaintLXH);
        return getDataTable(list);
    }

    /**
     * 导出个人投诉列表
     */
    @PreAuthorize("@ss.hasPermi('LXHComplaint:LXHDocComplaint:export')")
    @Log(title = "个人投诉", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DocComplaintLXH docComplaintLXH)
    {
        List<DocComplaintLXH> list = docComplaintLXHService.selectDocComplaintLXHList(docComplaintLXH);
        ExcelUtil<DocComplaintLXH> util = new ExcelUtil<DocComplaintLXH>(DocComplaintLXH.class);
        util.exportExcel(response, list, "个人投诉数据");
    }

    /**
     * 获取个人投诉详细信息
     */
    @PreAuthorize("@ss.hasPermi('LXHComplaint:LXHDocComplaint:query')")
    @GetMapping(value = "/{complaintId}")
    public AjaxResult getInfo(@PathVariable("complaintId") Long complaintId)
    {
        return success(docComplaintLXHService.selectDocComplaintLXHByComplaintId(complaintId));
    }

    /**
     * 新增个人投诉
     */
    @PreAuthorize("@ss.hasPermi('LXHComplaint:LXHDocComplaint:add')")
    @Log(title = "个人投诉", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DocComplaintLXH docComplaintLXH)
    {
        return toAjax(docComplaintLXHService.insertDocComplaintLXH(docComplaintLXH));
    }

    /**
     * 修改个人投诉
     */
    @PreAuthorize("@ss.hasPermi('LXHComplaint:LXHDocComplaint:edit')")
    @Log(title = "个人投诉", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DocComplaintLXH docComplaintLXH)
    {
        return toAjax(docComplaintLXHService.updateDocComplaintLXH(docComplaintLXH));
    }

    /**
     * 删除个人投诉
     */
    @PreAuthorize("@ss.hasPermi('LXHComplaint:LXHDocComplaint:remove')")
    @Log(title = "个人投诉", businessType = BusinessType.DELETE)
	@DeleteMapping("/{complaintIds}")
    public AjaxResult remove(@PathVariable Long[] complaintIds)
    {
        return toAjax(docComplaintLXHService.deleteDocComplaintLXHByComplaintIds(complaintIds));
    }
}
